$(function() {

	//=== low level

	$.SJR.option.type = 'POST';
	$.SJR.option.url  = '/_je/myDoc';
	$.SJR.option.data = {"foo":"bar"};
	$.SJR.option.success = function(response, status){console.log('ajax success');};
	$.SJR.option.error   = function(xhr, status, thrown){console.log('ajax error');};

	$.SJR.ajax();

	//=== 基本

	option = {
		"url"  : "/_je/myDoc",
		"data" : {"message":"これはテストです。"} // or "foo=bar"
	};
	success = function(response, status){
		var p = $('<p/>');
		var d = $('<div/>');
		for(var i in response)
			d.append(i+':'+response[i]+'<br/>');
		p.append(d);
		this.append(p);
	};
	error   = function(xhr, status, thrown){
		console.log('ajax error')
	};

	//$.extend

	$._GET (option, success, error);
	$._POST(option, success, error);
	$._PUT (option, success, error);
	$._DELETE(option, success, error);

	$._GET ($('#form'), success, error);
	$._POST($('#form'), success, error);
	$._PUT ($('#form'), success, error);
	$._DELETE($('#form'), success, error);

	// $.fn.extend
	$('._je/myDoc')._GET();

	$('.messages')._GET   (option, success, error);
	$('.messages')._POST  (option, success, error);
	$('.messages')._PUT   (option, success, error);
	$('.messages')._DELETE(option);

	$('.messages')._GET   ($('#form'), success, error);
	$('.messages')._POST  ($('#form'), success, error);
	$('.messages')._PUT   ($('#form'), success, error);
	$('.messages')._DELETE($('#form'), success, error);

});
